/*  1:   */ package nl.siegmann.epublib.viewer;
/*  2:   */ 
/*  3:   */ import java.awt.Image;
/*  4:   */ import javax.imageio.ImageIO;
/*  5:   */ import javax.swing.ImageIcon;
/*  6:   */ import javax.swing.JButton;
/*  7:   */ import org.slf4j.Logger;
/*  8:   */ import org.slf4j.LoggerFactory;
/*  9:   */ 
/* 10:   */ public class ViewerUtil
/* 11:   */ {
/* 12:14 */   private static Logger log = LoggerFactory.getLogger(ViewerUtil.class);
/* 13:   */   
/* 14:   */   static JButton createButton(String iconName, String backupLabel)
/* 15:   */   {
/* 16:26 */     JButton result = null;
/* 17:27 */     ImageIcon icon = createImageIcon(iconName);
/* 18:28 */     if (icon == null) {
/* 19:29 */       result = new JButton(backupLabel);
/* 20:   */     } else {
/* 21:31 */       result = new JButton(icon);
/* 22:   */     }
/* 23:33 */     return result;
/* 24:   */   }
/* 25:   */   
/* 26:   */   static ImageIcon createImageIcon(String iconName)
/* 27:   */   {
/* 28:38 */     ImageIcon result = null;
/* 29:39 */     String fullIconPath = "/viewer/icons/" + iconName + ".png";
/* 30:   */     try
/* 31:   */     {
/* 32:41 */       Image image = ImageIO.read(ViewerUtil.class.getResourceAsStream(fullIconPath));
/* 33:42 */       result = new ImageIcon(image);
/* 34:   */     }
/* 35:   */     catch (Exception e)
/* 36:   */     {
/* 37:44 */       log.error("Icon '" + fullIconPath + "' not found");
/* 38:   */     }
/* 39:46 */     return result;
/* 40:   */   }
/* 41:   */ }


/* Location:           C:\Users\David\workspace\CosaRaraPorqueSi\main\epublib-tools-3.1.jar
 * Qualified Name:     nl.siegmann.epublib.viewer.ViewerUtil
 * JD-Core Version:    0.7.0.1
 */